package huang.homework15;

import java.sql.SQLException;

public class UserService {
	public boolean register(User u) throws SQLException{
		boolean result =false;
		UserDao ud=new UserDao();
		User user=new User();
		user=ud.selectUserbyName(u.getUsername());
		if(user.getUsername()==null){
			ud.insert(u);
			result=true;
		}		
		return result;
	}
	public static void main(String[] args) throws SQLException {
		UserDao ud=new UserDao();
		UserService u=new UserService();
		User user=new User("huang","ad","male");
		System.out.println(u.register(user));
	}
}
